from django.db import models

# Create your models here.
class News(models.Model):
    title = models.CharField(max_length=255)
    content = models.TextField()
    class Meta:
        app_label = 'main'
    link = models.URLField(blank=True, null=True)
    date_posted = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title


class Message(models.Model):
    user_id = models.CharField(max_length=100)  # 留言的用户名或ID
    content = models.TextField()  # 留言内容
    created_at = models.DateTimeField(auto_now_add=True)  # 创建时间
    is_deleted = models.BooleanField(default=False)  # 用于标记留言是否被删除

    def __str__(self):
        return self.user_id